package com.yunyan.controller;

import com.yunyan.req.MajorParam;
import com.yunyan.req.PageReq;
import com.yunyan.resp.JsonResp;
import com.yunyan.service.MajorService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@CrossOrigin(origins = "http://localhost:8081")
@RestController
@RequestMapping("/major")
public class MajorController {


    @Resource
    private MajorService majorService;

    @GetMapping("/page")
    public JsonResp pageQuery(PageReq req, MajorParam param){
        return JsonResp.ok(majorService.pageQuery(req, param));
    }


    @GetMapping("/school")
    public JsonResp querySchool(@RequestParam String name){
        return JsonResp.ok(majorService.listByName(name));
    }
}
